﻿using System;
using System.Drawing;
using System.Windows.Forms;
using System.Windows.Input;

namespace RaisingStudio.SmallProgram.Library
{
    [SmallProgramType]
    public static class Mouse
    {
        public static Primitive IsLeftButtonDown
        {
            get
            {
                return new Primitive((Control.MouseButtons & MouseButtons.Left) == MouseButtons.Left);
            }
        }

        public static Primitive IsRightButtonDown
        {
            get
            {
                return new Primitive((Control.MouseButtons & MouseButtons.Right) == MouseButtons.Right);
            }
        }

        public static Primitive MouseX
        {
            get
            {
                return new Primitive(System.Windows.Forms.Cursor.Position.X);
            }
            set
            {
                System.Windows.Forms.Cursor.Position = new Point((int)value, (int)MouseY);
            }
        }

        public static Primitive MouseY
        {
            get
            {
                return new Primitive(System.Windows.Forms.Cursor.Position.Y);
            }
            set
            {
                System.Windows.Forms.Cursor.Position = new Point((int)MouseX, (int)value);
            }
        }

        public static void HideCursor()
        {
            GraphicsWindow.SetCursor(System.Windows.Input.Cursors.None);
        }

        public static void ShowCursor()
        {
            GraphicsWindow.SetCursor(System.Windows.Input.Cursors.Arrow);
        }

    }
}

